<template>
	<scroll-view :scroll-x="lxName==='hd'" class="pz_box cardCont" :class="lxName">
		<view v-for="(item, index) in list" :key="index" class="pz_box_item mb3"
			@click="jump2('/pages/setmeal/detail?id=',item.id)">
			<image class="pzImg" :src="item.imgurl?item.imgurl:imgHost+'/default_img.jpg'"></image>
			<view v-if="showList.indexOf('1') > -1"
				:class="item.type==0?'pz_box_item_box_tag blue':item.type==1?'pz_box_item_box_tag': 'pz_box_item_box_tag lv'">
				{{item.type==0?"门票次数卡":item.type==1?"门票期限卡":item.type==3?"课程预约次卡":item.type==4?"课程预约期限卡":"预定次卡" }}
			</view>
			<view v-if="item.name" class="pz_box_item_box">
				<view class="name">{{item.name}}</view>

				<view class="bmNum flex flex_between">
					<text v-if="item.validityType == '1'&& showList.indexOf('2') > -1">有效期：{{item.indate}}天</text>
					<text
						v-if="item.validityType == '0'&& showList.indexOf('2') > -1">有效期：{{item.validityStartTime.slice(5)}}
						- {{item.validityEndTime.slice(5)}}</text>
					<text v-if="showList.indexOf('3') > -1 && lxName ==='hd'" class="price"
						:class="item.price?'redColor':'green'">
						{{item.price?'¥':'免费'}}<text v-if="item.price">{{item.price}}</text>
					</text>
				</view>
				<view class="pzFoot flex flex_between">
					<view v-if="lxName !='hd' && showList.indexOf('3') > -1" class="price"
						:class="item.price?'redColor':'green'">
						{{item.price?'¥':'免费'}}<text v-if="item.price">{{item.price}}</text>
					</view>
					<view v-if="lxName !='hd' && showList.indexOf('3') == -1" class="price"></view>
					<view v-if="lxName ==='zt'" class="gmBtn">购买</view>
				</view>
			</view>
		</view>
	</scroll-view>
</template>

<script>
	export default {
		props: {
			lxName: {
				type: String,
				default: 'zt'
			},
			list: {
				type: Array,
				default: []
			},
			showList: {
				type: Array,
				default: ['1', '2', '3']
			},
		},
		methods: {
			jump(url, params, a) {
				this.$app.jump(url, params, a);
			},
			jump2(url, params, a) {
				this.$app.jump2(url, params, a);
			},
			tzDetail(item) {
				if (item.flag == '1') {
					this.jump2('/pages/curriculum/detailb?id=', item.courseId)
				} else {
					this.jump2('/pages/curriculum/detail?id=', item.courseId)
				}
			}
		}

	}
</script>
<style lang="scss" scoped>
	.pz_box {
		.pzImg {
			vertical-align: top;
		}

		.pz_box_item {
			width: 100%;
			border-radius: 8rpx;
			position: relative;
			overflow: hidden;
			background-color: #fff;

			.pz_box_item_box_tag {
				position: absolute;
				top: 20rpx;
				left: 20rpx;
				padding: 5rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				// background: $phb;
				background: $color;
				border-radius: 8rpx;
				font-size: 22rpx;
				color: #FFFFFF;

				// &.blue {
				// 	background: $blueBg;
				// }

				// &.lv {
				// 	background: linear-gradient(270deg, #6BE599 0%, #14B76D 100%);
				// }
			}

			.name {
				font-size: 30rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #222222;
				line-height: 1;
				margin-bottom: 15rpx;
			}

		}

		.price {
			font-size: 24rpx;

			text {
				font-size: 32rpx;
				font-weight: bolder;
			}
		}

		.pzFoot {

			.gmBtn {
				width: 112rpx;
				line-height: 52rpx;
				border-radius: 32rpx;
				border: 1rpx solid $color;
				font-size: 26rpx;
				text-align: center;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: $color;
			}
		}

		&.dt,
		&.sx {
			.pz_box_item {
				// border: 1rpx solid #E5E5E5;

				.pzImg {
					width: 100%;
					height: 388rpx;
				}

				.pz_box_item_box {
					position: static;
					box-sizing: border-box;
					padding: 20rpx;
					line-height: 1.5;
				}

				.bmNum {
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #999999;
				}
			}
		}

		&.dt {
			.pzFoot {
				position: absolute;
				right: 20rpx;
				bottom: 20rpx;
			}
		}

		&.sx {
			display: flex;
			flex-wrap: wrap;

			&:before {
				clear: both;
				content: '';
				display: block;
			}

			.pz_box_item {
				// border: 1rpx solid #E5E5E5;
				width: 49%;
				float: left;
				box-sizing: border-box;
				margin-right: 2%;

				&:nth-child(2n) {
					margin-right: 0;
				}

				.pzImg {
					height: 188rpx;
				}

				.pz_box_item_box {
					.bmNum {
						top: 126rpx;
					}

					.name {
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						line-height: 40rpx;
						-webkit-line-clamp: 1;
						/* autoprefixer: off */
						-webkit-box-orient: vertical;
						/* autoprefixer: on */
					}
				}

			}
		}

		&.hd {
			white-space: nowrap;
			display: flex;

			.pz_box_item {
				// border: 1rpx solid #E5E5E5;
				width: 440rpx;
				display: inline-block;
				margin-right: 30rpx;
				background-color: #fff;

				&:last-of-type {
					margin-right: 0;
				}

				.pzImg {
					width: 100%;
					height: 247rpx;
				}

				.pz_box_item_box {
					position: static;
					box-sizing: border-box;
					padding: 20rpx;

					.name {
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						line-height: 40rpx;
						-webkit-line-clamp: 1;
						/* autoprefixer: off */
						-webkit-box-orient: vertical;
						/* autoprefixer: on */
					}

					.bmNum {
						font-size: 24rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #999999;
						margin-bottom: 10rpx;
					}

					// .price {
					// 	position: absolute;
					// 	right: 20rpx;
					// 	bottom: 20rpx;
					// }
				}
			}
		}


		&.zt {
			.pz_box_item {
				display: flex;
				justify-content: space-between;
				background: none;

				.pzImg {
					width: 260rpx;
					border-radius: 8rpx;
					flex: none;
					height: 146rpx;
				}

				.pz_box_item_box {
					flex: 1;
					box-sizing: border-box;
					padding-left: 20rpx;

					position: static;

					.name {
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						line-height: 1.3;
						-webkit-line-clamp: 2;
						/* autoprefixer: off */
						-webkit-box-orient: vertical;
						/* autoprefixer: on */
					}

					.bmNum {
						font-size: 24rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #999999;
						margin-bottom: 10rpx;
					}
				}
			}
		}
	}
</style>